<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div>
        <input type="text" id="inputEle">
        <span id="errorEle" style="display: none;">账号格式不正确</span>
    </div>
    <span id="tipEle" style="display: none;">账号只能是手机号或邮箱</span>


    <div>
        <select id="selectEle">
            <option value="">四川</option>
            <option value="">云南</option>
            <option value="">贵州</option>
        </select>
    </div>


    <form id="formEle">
        <input type="text">
        <input type="submit">
        <button>提交按钮</button>
        <input type="reset">
        <button type="reset">重置按钮</button>
    </form>

    <script>
        inputEle.onfocus = function () {
            // console.log("获得焦点");
            tipEle.style.display = "inline";
        }

        inputEle.onblur = function () {
            // console.log("失去焦点");
            errorEle.style.display = "inline";
        }

        inputEle.oninput = function () {
            // console.log("内容输入变化");
        }

        inputEle.onchange = function () {
            // console.log("内容变化完成");
        }

        selectEle.onchange = function () {
            // console.log("下拉列表的选择改变");
        }

        formEle.onsubmit = function (event) {
            event.preventDefault();
            console.log("表单被提交了");
        }

        formEle.onreset = function() {
             console.log("表单被重置了");
        }

    </script>
</body>

</html>